package com.csj.DesignPattern.command;

import java.util.Map;

public class OrderCommand implements Command {

    private SeniorChef receiver;

    private Order order;

    public OrderCommand(SeniorChef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }

    @Override
    public void execute() {
        System.out.println(order.getDinningTable() + "桌的订单：");
        Map<String, Integer> foodDir = order.getFoodDir();
        foodDir.forEach((name, num) -> {
            receiver.makeFood(name, num);
        });
        System.out.println(order.getDinningTable() + "桌的订单：完成");
    }
}
